package com.shrcl.engineerprocess.domain.events;

import com.shrcl.engineerprocess.domain.EngineerProject;
import com.shrcl.engineerprocess.domain.EngineerProjectJob;
import com.shrcl.engineerprocess.domain.events.EngineerProjectEventsListener;
import edu.fudan.mylang.pf.event.EntityEventsManager;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("com.shrcl.engineerprocess.domain.events.EngineerProjectEventsManager")
public class EngineerProjectEventsManager extends EntityEventsManager<EngineerProject> {
  @Autowired(required = false)
  private Collection<EngineerProjectEventsListener> listeners = com.google.common.collect.Lists.newArrayList();;
  
  protected Collection<EngineerProjectEventsListener> getListeners() {
    return listeners;
  }
  
  public void fireKickoff(final EngineerProject entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerProjectEventsListener)listener).kickoff(entity);
    }
    
  }
  
  public void fireFinish(final EngineerProject entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerProjectEventsListener)listener).finish(entity);
    }
    
  }
  
  public void fireAddProjectJob(final EngineerProject entity, final Procedure1<? super EngineerProjectJob> init) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerProjectEventsListener)listener).addProjectJob(entity,init);
    }
    
  }
  
  public void fireDelProjectJob(final EngineerProject entity, final EngineerProjectJob engineerProjectJob) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerProjectEventsListener)listener).delProjectJob(entity,engineerProjectJob);
    }
    
  }
}
